﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using PowersourceUIToolkit;
using UCL.Powersource.ViewModels;

namespace Powersource.TestApp
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {

        UCL.Powersource.IPowersourceExt IPowersourceExt;
        private ContentControlConductor Conductor;
        private PowersourceMainViewModel PSMainViewModel;
        //PowersourceUIToolkit.DummyUIManager 

        public MainWindow()
        {
            InitializeComponent();
            IPowersourceExt = UCL.Powersource.PowersourceConnector.GetExtensibilityPoint();

            //uiManager.ActivateViewModelInConductor();
            this.Loaded += MainWindow_Loaded;
            this.Unloaded += MainWindow_Unloaded;
        }

        void MainWindow_Unloaded(object sender, RoutedEventArgs e)
        {
            if (PSMainViewModel != null) PSMainViewModel.Deactivate();
        }

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            PSMainViewModel=ViewModelLocator.GetViewModel<PowersourceMainViewModel>();
            
            //PSMainViewModel.CurrentTfsTeamProjectCollectionConfiguration = new Dumm
            Conductor = new ContentControlConductor(ccPowersource);
            Conductor.Initialize();
            IPowersourceExt.UIManager.ActivateViewModelInConductor(PSMainViewModel,Conductor);
        }
    }
}
